$(function () {
	//下拉框
	JY.Dict.setSelect("selectisValid","isValid",2,"全部");
	getRoleList(1);

});
function getRoleList(init){
	if(init==1)$("#baseForm .pageNum").val(1);	
	JY.Model.loading();
	JY.Ajax.doRequest("baseForm",jypath +'/system/role//list',null,function(data){
		 $("#baseTable tbody").empty();
		     //分页对象
        	 var page=data.obj;
        	 //权限按钮
        	 //var permitBtn=obj.permitBtn;
      		 var permitBtn=[{name:"查看职务",btnFun:"checkPos",icon:"icon-zoom-in color-purple"}
				,{name:"修改职务",btnFun:"editPos",icon:"icon-edit color-blue"}
				,{name:"删除职务",btnFun:"delPos",icon:"icon-remove-sign color-red"}];
        	 //数据集合
        	 var results=page.rows;
        	 //分页数据
         	 var pageNum=page.pageNumber,pageSize=page.pageSize,totalRecord=page.total;
        	 var html="";
    		 if(results!=null&&results.length>0){
        		 var leng=(pageNum-1)*pageSize;//计算序号
        		 for(var i = 0;i<results.length;i++){
            		 var l=results[i];
            		 html+="<tr>";
            		 html+="<td class='center'><label> <input type='checkbox' name='ids' value='"+l.id+"' class='ace' /> <span class='lbl'></span></label></td>";
            		 html+="<td class='center hidden-480'>"+(i+leng+1)+"</td>";
            		 html+="<td class='center'>"+JY.Object.notEmpty(l.roleName)+"</td>";
            		 html+="<td class='center hidden-480' >"+JY.Object.notEmpty(l.roleIndexPage)+"</td>";
            		 html+="<td class='center '>"+JY.Object.notEmpty(l.sort)+"</td>";
            		 html+=JY.Tags.setFunction(l.accountId,permitBtn);
            		 html+="</tr>";		 
            	 } 
        		 $("#baseTable tbody").append(html);
        		 JY.Page.setPage("baseForm","pageing",pageSize,pageNum,totalRecord,"getbaseList");
        	 }else{
        		html+="<tr><td colspan='10' class='center'>没有相关数据</td></tr>";
        		$("#baseTable tbody").append(html);
        		$("#pageing ul").empty();//清空分页
        	 }	
 	 
    	 JY.Model.loadingClose();
	 });
}